[LinearSystem] Introduce ConstantSparsityProjectionMethod #4552
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Based on #4547. The diff: alxbilger/sofa@sparsematrixproduct...alxbilger:sofa:constantsparsityprojection
Matrix projection method taking advantage of the constant sparsity of the matrices in the computation of sparse matrix product. A boolean Data enables parallel computation.
Benchmark on the reduced diamond for 1000 time steps (previous results in #4490):
MatrixProjectionMethod + areJacobiansConstant=False
This is the most generic method
MatrixProjectionMethod + areJacobiansConstant=True
ConstantSparsityProjectionMethod + areJacobiansConstant=True + parallelProduct=False
Note that the timer includes the first iteration which is very very slow. It alters the average.
ConstantSparsityProjectionMethod + areJacobiansConstant=True + parallelProduct=True
Note that the timer includes the first iteration which is very very slow. It alters the average.
Conclusion
We can observe that the parallelism is necessary to take advantage of the constant sparsity pattern. The fastest configuration is now
ConstantSparsityProjectionMethod + areJacobiansConstant=True + parallelProduct=Truecompared toMatrixProjectionMethod + areJacobiansConstant=Truebefore this PR. It's a speed up of x1.8.For the records, at the beginning of this series of enhancement (#4443), the reduced diamond run at 44 FPS. Now it is 222 FPS = speed up x5.
By submitting this pull request, I acknowledge that
I have read, understand, and agree SOFA Developer Certificate of Origin (DCO).
Reviewers will merge this pull-request only if